package com.ibm.cognos.imt.fm

import groovy.util.slurpersupport.NodeChild

/**
 * Created by eric on 8/21/2014.
 */
class NameSpace {
    String name
    List<QuerySubject> querySubjects = new ArrayList<>()
    List<NameSpace> namespaces = new ArrayList<>();
    List<Shortcut> shortcuts = new ArrayList<>();

    List<NameSpace> getNamespaces() {
        return namespaces
    }

    public NameSpace(String string) {

    }

    public NameSpace(NodeChild path) {
        def nameNode = path.name.findAll {
            it.@locale == 'en'
        }
        name = nameNode[0].text();
        def nsNode = path.namespace.each {
            NameSpace ns = new NameSpace(it)
            namespaces << ns
        }
        def shortcutNode = path.shortcut.each {
            Shortcut shortcut = new Shortcut(it)
            shortcuts<<shortcut
        }
        def qsNode = path.querySubject.each {
            QuerySubject qs = new QuerySubject(it)
            querySubjects<<qs
        }
    }


}
